<template>
  <div class="home">
     <p>来积云学习的第{{num}}天</p>
     <p>吃饭消费{{money}}</p>
     <button @click="add">时光计时器</button>
     <ul>
      <li v-for="(item,index) in $store.state.goodList" :key="index">{{item.goods_name}}</li>
     </ul>
  </div>
</template>
<script>
import { mapState,mapGetters,mapMutations,mapActions } from 'vuex';
export default {
  name: 'HomeView',
  components: {},
  computed:{
    ...mapState({
      num: 'day'
    }),
    ...mapGetters(['money'])
  },
  created() {
    this.getGoods();
  },
  methods: {
    ...mapMutations(['add']),
    ...mapActions(['getGoods'])
  },
}
</script>
